﻿<phone:PhoneApplicationPage 
	x:Class="BubbleWrapUltimate.MainPage"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
	xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
	xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
	mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="800"
	FontFamily="{StaticResource PhoneFontFamilyNormal}"
	FontSize="{StaticResource PhoneFontSizeNormal}"
	Foreground="{StaticResource PhoneForegroundBrush}"
	SupportedOrientations="Portrait"  Orientation="Portrait"
	shell:SystemTray.IsVisible="False"
	Loaded="MainPageLoaded">

	<!--LayoutRoot is the root grid where all page content is placed-->
	<Grid x:Name="LayoutRoot" Background="Transparent">
		<!--Pivot Control-->
		<controls:Pivot Title="BUBBLEWRAP ULTIMATE"
						x:Name="mainPivot"
						LoadedPivotItem="PivotLoadedPivotItem">

			<controls:PivotItem Header="Game" x:Name="gamePage">
				<Grid x:Name="Main" Background="Transparent">
					<Grid.RowDefinitions>
						<RowDefinition Height="80"/>
						<RowDefinition Height="480"/>
						<RowDefinition Height="*"/>
					</Grid.RowDefinitions>

					<Grid x:Name="Status" Grid.Row ="0">
						<Grid.RowDefinitions>
							<RowDefinition />
							<RowDefinition />
						</Grid.RowDefinitions >
						<Grid.ColumnDefinitions>
							<ColumnDefinition />
							<ColumnDefinition Width="160" />
						</Grid.ColumnDefinitions>
						<TextBlock x:Name="PlayerName" Text="Player" />
						<TextBlock x:Name="ScoreText" Text="Bubbles popped so far: 0" Grid.Row="1"/>
						<TextBlock x:Name="timerOutput" Grid.Column="1" Text="Timer"/>
						<TextBlock x:Name="LevelText" Grid.Column="1" Grid.Row="1" Text="Level"/>
					</Grid>
					<Grid x:Name="bubbleField" Grid.Row ="1">
						<Grid.RowDefinitions>
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
							<RowDefinition />
						</Grid.RowDefinitions>
						<Grid.ColumnDefinitions>
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
							<ColumnDefinition />
						</Grid.ColumnDefinitions>

						<Grid.Background>
							<ImageBrush ImageSource="..\Image\background.jpg"/>
						</Grid.Background>
						
						<!--Row 0-->
						<Image Grid.Column ="1" Grid.ColumnSpan="2" Grid.Row="0" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="3" Grid.ColumnSpan="2" Grid.Row="0" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="5" Grid.ColumnSpan="2" Grid.Row="0" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="7" Grid.ColumnSpan="2" Grid.Row="0" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="9" Grid.ColumnSpan="2" Grid.Row="0" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />

						<!--Row 1-->
						<Image Grid.Column ="0" Grid.ColumnSpan="2" Grid.Row="1" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="2" Grid.ColumnSpan="2" Grid.Row="1" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="4" Grid.ColumnSpan="2" Grid.Row="1" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="6" Grid.ColumnSpan="2" Grid.Row="1" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="8" Grid.ColumnSpan="2" Grid.Row="1" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="10" Grid.ColumnSpan="2" Grid.Row="1" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />

						<!--Row 2-->
						<Image Grid.Column ="1" Grid.ColumnSpan="2" Grid.Row="2" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="3" Grid.ColumnSpan="2" Grid.Row="2" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="5" Grid.ColumnSpan="2" Grid.Row="2" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="7" Grid.ColumnSpan="2" Grid.Row="2" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="9" Grid.ColumnSpan="2" Grid.Row="2" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />

						<!--Row 3-->
						<Image Grid.Column ="0" Grid.ColumnSpan="2" Grid.Row="3" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="2" Grid.ColumnSpan="2" Grid.Row="3" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="4" Grid.ColumnSpan="2" Grid.Row="3" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="6" Grid.ColumnSpan="2" Grid.Row="3" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="8" Grid.ColumnSpan="2" Grid.Row="3" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="10" Grid.ColumnSpan="2" Grid.Row="3" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />

						<!--Row 4-->
						<Image Grid.Column ="1" Grid.ColumnSpan="2" Grid.Row="4" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="3" Grid.ColumnSpan="2" Grid.Row="4" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="5" Grid.ColumnSpan="2" Grid.Row="4" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="7" Grid.ColumnSpan="2" Grid.Row="4" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="9" Grid.ColumnSpan="2" Grid.Row="4" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />

						<!--Row 5-->
						<Image Grid.Column ="0" Grid.ColumnSpan="2" Grid.Row="5" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="2" Grid.ColumnSpan="2" Grid.Row="5" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="4" Grid.ColumnSpan="2" Grid.Row="5" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="6" Grid.ColumnSpan="2" Grid.Row="5" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="8" Grid.ColumnSpan="2" Grid.Row="5" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="10" Grid.ColumnSpan="2" Grid.Row="5" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />

						<!--Row 6-->
						<Image Grid.Column ="1" Grid.ColumnSpan="2" Grid.Row="6" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="3" Grid.ColumnSpan="2" Grid.Row="6" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="5" Grid.ColumnSpan="2" Grid.Row="6" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="7" Grid.ColumnSpan="2" Grid.Row="6" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />
						<Image Grid.Column ="9" Grid.ColumnSpan="2" Grid.Row="6" Stretch="Fill" ManipulationStarted="ImageManipulationStarted" MouseEnter="ImageMouseEnter" />

					</Grid>
					<Grid x:Name="ContentPanel" Grid.Row="2">
						<Button x:Name="MoreButton" Content="Start!" Click="MoreButtonClick" FontSize="36" />
					</Grid>
				</Grid>
			</controls:PivotItem>
 
			<controls:PivotItem Header="Settings" x:Name="settingsPage" >
				<StackPanel>
					<TextBlock Text="Change Name" FontWeight="Bold"  FontSize="20" />
					<TextBox x:Name="PlayerNameTextBox" Text="Player"  FontSize="24" MaxLength="30" />
					<Button x:Name="SetNameButton" Content="Set" Click="SetNameButtonClick"/>
					<TextBlock x:Name="Score" Text="Bubbles popped so far: 0" Margin="0,10,0,0" FontSize="18" />
					<TextBlock x:Name="Level" Text="Level: 0" Margin="0,10,0,10" FontSize="18" />
					<CheckBox x:Name="Sounds" Content="Play sounds" FontSize="18" Checked="SoundsChecked" Unchecked="SoundsUnchecked" />

					<Grid>
						<Grid.ColumnDefinitions>
							<ColumnDefinition />
						</Grid.ColumnDefinitions>
						<Grid.RowDefinitions>
							<RowDefinition/>
							<RowDefinition/>
						</Grid.RowDefinitions>
						<TextBlock Text="Awards" FontSize="35" FontWeight="Bold" />
						<ListBox x:Name="awardsList" Grid.Row="1">
							<ListBox.ItemTemplate>
								<DataTemplate>
									<Grid>
										<Grid.ColumnDefinitions>
											<ColumnDefinition Width="30"/>
											<ColumnDefinition/>
										</Grid.ColumnDefinitions>

										<Image Source="{Binding AwardImage}" Width="30" Height="50"/>
										<TextBlock FontSize="22" Text="{Binding AwardName}" Margin="20,0,0,0" Grid.Column="1" />
									</Grid>
								</DataTemplate>
							</ListBox.ItemTemplate>
						</ListBox>
					</Grid>
				</StackPanel>
			</controls:PivotItem>

			<controls:PivotItem Header="Top Score" x:Name="scorePage">
				<Grid>
					<Grid.RowDefinitions>
						<RowDefinition Height="70"/>
						<RowDefinition Height="Auto"/>
						<RowDefinition Height="Auto"/>
						<RowDefinition/>
					</Grid.RowDefinitions>
					<Grid.ColumnDefinitions>
						<ColumnDefinition/>
						<ColumnDefinition/>
					</Grid.ColumnDefinitions>

					<Button Content="Order by level" x:Name="orderLevel" Style="{StaticResource LawBotBlueGlossyButtonStyle}" Height="55"
						Margin="10,5,10,5"  FontSize="22" Foreground="#FFCDD5E2" Click="OrderLevelClick" />
					<Button Content="Order by bubbles" x:Name="orderBubbles" Grid.Column="1" Style="{StaticResource LawBotBlueGlossyButtonStyle}" Height="55"
						Margin="10,5,10,5"  FontSize="22"  Foreground="#FFCDD5E2" Click="OrderBubblesClick" />

					<Grid Margin="0,10,0,5" x:Name="playerPosition" Grid.Row="1" Grid.ColumnSpan="2">
						<Grid.RowDefinitions>
							<RowDefinition/>
							<RowDefinition/>
							<RowDefinition/>
							<RowDefinition/>
						</Grid.RowDefinitions>
						<Grid.ColumnDefinitions>
							<ColumnDefinition Width="80"/>
							<ColumnDefinition Width="100"/>
							<ColumnDefinition />
							<ColumnDefinition Width="120"/>
							<ColumnDefinition />
						</Grid.ColumnDefinitions>

						<TextBlock Text="Your position" Grid.ColumnSpan="5" FontSize="25" FontWeight="Bold" Foreground="Gold"/>

						<TextBlock FontSize="50" Text="{Binding Position}" Grid.RowSpan="3" Grid.Row="1" FontWeight="Bold" Foreground="Gold" HorizontalAlignment="Center" VerticalAlignment="Center" />

						<TextBlock FontSize="22" Text="{Binding Name}" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="4" Margin="10,0,0,0" FontWeight="Bold" Foreground="Gold"  />

						<TextBlock FontSize="22" Text="Bubbles" Grid.Row="2" Grid.Column="1" Margin="10,0,0,0" Foreground="Gold" />
						<TextBlock FontSize="22" Text="{Binding BubblePopped}" Grid.Row="2" Grid.Column="2" Foreground="Gold" />

						<TextBlock FontSize="22" Text="Level" Grid.Row="2" Grid.Column="3" Margin="20,0,0,0" Foreground="Gold" />
						<TextBlock FontSize="22" Text="{Binding Level}" Grid.Row="2" Grid.Column="4" Foreground="Gold" />

						<StackPanel Orientation="Horizontal" Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="4" Margin="10,0,0,0">
							<Image Source="..\Image\Awards\0_silver_plain.png" Visibility="{Binding AwardVisible1}"/>
							<Image Source="..\Image\Awards\1_silver_stripe.png" Visibility="{Binding AwardVisible2}"/>
							<Image Source="..\Image\Awards\2_silver_star.png" Visibility="{Binding AwardVisible3}"/>
							<Image Source="..\Image\Awards\3_silver_stripe_star.png" Visibility="{Binding AwardVisible4}"/>
							<Image Source="..\Image\Awards\4_gold_plain.png" Visibility="{Binding AwardVisible5}"/>
							<Image Source="..\Image\Awards\5_gold_star.png" Visibility="{Binding AwardVisible6}"/>
							<Image Source="..\Image\Awards\6_gold_stripe.png" Visibility="{Binding AwardVisible7}"/>
							<Image Source="..\Image\Awards\7_gold_badge.png" Visibility="{Binding AwardVisible8}"/>
						</StackPanel>
					</Grid>
					<TextBlock Text="Top Players List" Grid.Row="2" Grid.ColumnSpan="5" FontSize="25" FontWeight="Bold"/>

					<ListBox x:Name="topPlayersList" Grid.Row="3" Grid.ColumnSpan="2">
						<ListBox.ItemTemplate>
							<DataTemplate>
								<Grid Margin="0,10,0,5">
									<Grid.RowDefinitions>
										<RowDefinition />
										<RowDefinition />
										<RowDefinition />
									</Grid.RowDefinitions>
									<Grid.ColumnDefinitions>
										<ColumnDefinition Width="80"/>
										<ColumnDefinition Width="100"/>
										<ColumnDefinition />
										<ColumnDefinition Width="120"/>
										<ColumnDefinition />
									</Grid.ColumnDefinitions>

									<TextBlock  FontSize="50" Text="{Binding Position}" Grid.RowSpan="3" FontWeight="Bold" HorizontalAlignment="Center" VerticalAlignment="Center" />

									<TextBlock FontSize="22" Text="{Binding Name}" Grid.Column="1" Grid.ColumnSpan="4" Margin="10,0,0,0" FontWeight="Bold" />
									<TextBlock FontSize="22" Text="Bubbles:" Grid.Row="1" Grid.Column="1" Margin="10,0,0,0" />
									<TextBlock FontSize="22" Text="{Binding BubblePopped}" Grid.Row="1" Grid.Column="2" />
									<TextBlock FontSize="22" Text="Level:" Grid.Row="1" Grid.Column="3" Margin="20,0,0,0" />
									<TextBlock FontSize="22" Text="{Binding Level}" Grid.Row="1" Grid.Column="4" />

									<StackPanel Orientation="Horizontal" Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="4"  Margin="10,0,0,10">
										<Image Source="..\Image\Awards\0_silver_plain.png" Visibility="{Binding AwardVisible1}"/>
										<Image Source="..\Image\Awards\1_silver_stripe.png" Visibility="{Binding AwardVisible2}"/>
										<Image Source="..\Image\Awards\2_silver_star.png" Visibility="{Binding AwardVisible3}"/>
										<Image Source="..\Image\Awards\3_silver_stripe_star.png" Visibility="{Binding AwardVisible4}"/>
										<Image Source="..\Image\Awards\4_gold_plain.png" Visibility="{Binding AwardVisible5}"/>
										<Image Source="..\Image\Awards\5_gold_star.png" Visibility="{Binding AwardVisible6}"/>
										<Image Source="..\Image\Awards\6_gold_stripe.png" Visibility="{Binding AwardVisible7}"/>
										<Image Source="..\Image\Awards\7_gold_badge.png" Visibility="{Binding AwardVisible8}"/>
									</StackPanel>
								</Grid>
							</DataTemplate>
						</ListBox.ItemTemplate>
					</ListBox>
				</Grid>
			</controls:PivotItem>
		</controls:Pivot>
	</Grid>
 
	<!--Sample code showing usage of ApplicationBar-->
	<!--<phone:PhoneApplicationPage.ApplicationBar>
		<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
			<shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
			<shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
			<shell:ApplicationBar.MenuItems>
				<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
				<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
			</shell:ApplicationBar.MenuItems>
		</shell:ApplicationBar>
	</phone:PhoneApplicationPage.ApplicationBar>-->

</phone:PhoneApplicationPage>